Fixing up bounds detection