correctly bind parameters. closes #1440, #1439