some stuff for reducing bound checks