improved index checking macros.