added error printing to flask app