Always check for availablity of decoder.end()

Otherwise it will fail on node v0.8.x