fixes bugs #1 anf #5 regarding empty folders and implements enhancement #2