Fixed bug in duration checking