Fixed work with .pid file, add condition to check wether the process truly running