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