fixing typo and double resonse.end calls in case of the default case in the switch