set purchase log to avoid undefined exception
removed unneded globals variables