fail function is now called when a error occours

As said in title, the method, now calls the fail method when something bad happens
This is the behaviour followed by any other functions.

Daniele.