Don't use deprecated apis & code cleanup

get rid of bunch of compiler warnings