small bugfixes, tests for write hook in place