fixed errors of type mismatch