Fix the source of the bug #12, and fix a new regarding bug on resize.