Remove use of deprecated method to avoid compiler warnings