changes to make write.php callable from shell