Bug fix on form submit