Solved bug in isFolder function.