Replaced a deprecated function with a new one to prevent notices.