fixed memory issues with nwalign