fix mmap_length handling for consistency