Eliminate compile warning and deprecated functions