fixed a bug where a bad search would break the program