changed sync method, added resize event