fix overrun in check functions