Sql objects refactoring fix