dont call pre/post write callbacks if callback is null

this fixes issue #28