Added failure checking to changes of last commmit

Functionality still the same. Automated testing failed. Now it shall be working