prevent out of bounds references