Prevent entering directories twice.