Added a failure check

by https://github.com/nallar