Fixed a bug where max and min hours were not used