logging the stack trace when possible

I was missing a good stack trace to debug ReferenceError s and alikes with a clue where to start searching