The sentences are,
Filling the shopping cart with D batteries and bottled water, we finally completed our hurricane preparation.
Filling the shopping cart with D batteries and bottled water, our hurricane preparation was finally complete.
I have been told that the latter sentence is correct whereas the former one is not. I am confused and can't understand why the first sentence isn't correct. Anybody who can explain the rule, please?