Update lib.js

Fix fail callback