Modify flashBufferRead and added test code for it