Errors fixes for bluetooth communication