Added Support for handling 404

Added Support for handling 401