Safe check for dict