Fixed bug in interval searching