fixed a bug where unmap could be called with a NULL buffer