consider adding null-checks for both key and value