Made this work with postgres