Fixed problem due to fork()