convert buffer to an array in a way that works in 0.8 (i hope)