Fix use of deprecated method