Bug fix in model/sql and indentation modifications