Corrected a bug to lower memory footprint.