Add more error conditions to getBufferSubData