added functions for 404 and 400 errors