Mathf bug fixes