integrating fixdefect into main lib as function. need to finish and test
removed fixdefect as it's a function in main lib
changes that i had made in bin. fix the global variable stuff