Fix error handling in stcp