Bad param escaping and extra parenthesis fix

This is the way that @cwolferh suggested we do it based on some testing he did, I believe.