fix python directory listing
fix the behavior in case of non-linux kernel stack (i.e., freebsd at the moment)