added modal submit and some fixes for error handling