fix #1878
Fix previous commit memleak and handle <=N bwdisasm