Fix kind checking, code gen for dictionaries