Partially revert e51ef0b. Fixed accidental commit that messed up sql inserts