fix callbacks and add tests for them.