Fixed bug with unwritable lock and pid files