UnsupportedOperationException: direct buffer fix