Bug fix and new unit tests

Fix a bug in add_time and add new unit test to increase code coverage.