adding support for node 0.11 and better error logging