fix error if key is null