Fixes for deprecated functions and other bugs