fixed bug in error handling on service.js