add lock for console app