added code for graceful error pages