fixed a bug where completion handler got nullified before it gets called