Fixed some filesystem-related bugs