cleanup directories -> directory
fix bag for bash 4