Give proper stack trace when debug mode is enabled