added some bug fixes for search
completed merge