use mmap to allocate memory for handlers, bug fix