Fixed a bug on hours calculation