fix py3 bugs, set size attribute when missing