Fix a bug of error500 instead of 404 when DEBUG was false, add custom error pages