Bugfix: Fixed bug with writing larger ROM images.

Fixed bug in sector calculation for large ROM images.
Fixed bug in sector erase function.