Fix forever hang when a 404 appeared the 2nd time.

Add some notfound logic for frontend.