[en] fix thread-safety problem (could cause e.g.  java.nio.InvalidMarkException)