added bounds check for physics