Fix float casting bug