Fix errors in code