main functionality fixes