Fix wrong error messages on optional key dict val