Fix wrong error message on optional key dict val