Fix a few bounds related bugs
moar keys