fix php error notices and date formatting