more robust grep