cleanup and fix resize