Fix callback issue

Does a quick last minute check to see that the callback isn't undefined before calling it.

This fixes an issue under windows and latest node version.