[0.1.5] fix null chain tail bug, add test

Signed-off-by: Eli Skeggs <skeggse@gmail.com>