fixed bug with $setOnFail; new version