fix broken implementation, virtual memory must be taken into account