make hour handling more robust