fixed pid file management & added SIGHUP event hanlder