Fixed bug in linear search