changed error function name to be compatible with elzabad's code