add check that buffer exists before ending it, bump to v 1.0.3