fix/corrects a bug that reduced time from total
fix/global variables issues