fixed errors and now this version passes the npm test