fixing errors in code