How to not use the deprecated method