improved error handling and sending methods