Fixing call to deprecated function