replace deprecated method call with newr one and fixed typo