Fix duration check

This PR fixes #53.