Fixed bug with Queue::CastToBufferType()

Change-Id: I7bb2e049561973b716dc3952d7b0ef4490b4cf0a