more memory improvements