fixed read codes
relocation is NOT working
fixed readState
manual merge