fixed errors and impl