Added check for empty dict.