Fixed various bugs to send without corruption