more robust removal of planes