Done some fixes to make it work with timestamps

Don't know if you want to merge these into your pull request?