Removed deprecated method statements
Fixed API error handling