Fixing issue #70 - Running code before redirect not working