Fixes fmod out of bounds exception