Fix usage of a non declared function on error case

Change-Id: I8a0f2e4c1b7a1682bcc4aa83b7733fec4011becf