chnage codes & fix some errors