Cast to right type in dictNext().

This closes issue #1929, the other part was fixed in the context of issue