add robustness in _resize()
related to https://github.com/bemtv/flashls/commit/4635e3b1a667d34923b6377037ac8a8d2a686dc5