Fix missing semicolons and wrong references