Fixed error handling for inbound connection as well