patch up types module: deal with corner cases, add isPrimitive and isObject functions; get rid of junk module