Please fix the grammar errors in the following sentence:
If the train was installed with this system, the accident might not have happened.
If the train had been installed with this system, the accident might not have happened.