added undefined check for ls
forgot build