fix before and after search