Fixing float to int cast error