better error logging. fix problem with coffeescript context