added extra error catch to username middleware