I've updated the PR to do it correctly. Tested with a program where the DATA segment is in the $4xxx area. It crashed in the old version, with the new version it works.