better error handling
send json type only (except for index and badge)