fixed errors so that it runs