Fixed compile warnings

I updated this to use non deprecated methods.