several errors fixed