Fix nullPointerException with OnBytesAvailable