Fixes the cancel button redirect issue