Bug fixes in the pgsql functions
Implemented CHG command receiving + loading states at the server start