fix issue #16 - now it is fork safe