Fixed bug in takeflats