Fixed some issues causing PHP Error Notices