handle empty directories. Fix #42