fix map implementation, optimize inheritsFrom