more defensive get_cached_payload function

@czue 
W293 blank line contains whitespace