put in recovery mode and update your iphone with latest firmware....you hae to press and hold home button + power button....your iphone will be switch off then press home button and insert cable .....now your phone in recovery mode so ucan update with new firmware or firmware which you want...if you update to os4 u cant unlock 3gs at the moment