fixed assertion exception
decreased memory usage