fix bugs caused by unquoted variable(s); remove unnecessary grep in ips func

fix bugs caused by unquoted variable(s); remove unnecessary grep in ips func