fixing the main, working before ndb