more defensive get_cached_payload function

@czue 
yes thanks, added.