Made it work with postgres