added directory empty check