fixed main errors