added waitpid to ls call