Bugfix and allow for REPLACE queries