replaced deprecated function with newer version