resize improved and bugfix