type-checking errors fixed