fixed syntax errors and deprecated method