fix access to unmapped memory