As suggested, changed m_block_pos to long. Tested and worked with my image. Also, fixed another misalignment.