improve mem sanity check
check mem buffer alignment