fix nasty invalidateSize() bug