Fix some deprecated functions and code sniffer errors