Fixed resize function for Layout.init