removed usage of getmypid() which is not always available