Fix compatibility problems with getbufvar

This should address #95 while still keeping expected behavior.