fixed all problems in code