Integer compared to float? And later saved as integer? This looks wrong IMO.