Changed error output to indicate the stage it occured at