Fixed bug with am/pm detection