remove use of directory
stop relying clobbering value of global dir() function(!)