Fixed various bugs with directory entries