Fixed cctype functions usage; fixed loading history bug.