more fixes and tests for #4

turns out the cron hook callback parameters were incorrect, also fixed a
couple of other bugs, moved the comments up a bit