Fixing bug in comparing times