bulletproof auto-resize