fix lock on read when buffer was 0