Changed getDataFromBuffer() to not return reference

Returning temporary objects by reference doesn't work well.