Fixed PHP depricatation errors and notices.