Properly casting the query for overwrite updates

Before, was just skipping over the casting, should be taken care of now