Fixes for Postgre SQL