fixed bug with restify
added errors