Fix javascript float casting error