Fixed out-of-bounds map handling