adds debug mode back using before action handler

Signed-off-by: Simon Thulbourn <simon+github@thulbourn.com>