Bug fix: PreparedQuery with parameters

When a PreparedQuery referenced the same parameter more than once, the
value was only replaced at the first occurrence.