fix to work in rectangular containers