fixed removing of last profile + optimized garbage handling