Fixed bug where invalid values would not trigger correct flash message and redirection.