fixed #26, welcome to callback hell