Fixed various PHP warnings and non fatal errors