Fixed pid file issues