Fix postgresql problems