Fixed postgre bug