Replace deprecated error() and complete() functions by fail() and done()