The type was changed from int to float, because comparing the int to values (e.g. type == 1) never returned true...