Fix code up for wanrnings, deprecated PHP etc