BUGFIX: work correctly if process forks