better error handling for not found case