Added custom error and advagg