Bug Corrections and improvements