Fix warnings and upgrade script for 2.6/2.7.

    * Fix warnings related to context, settype
    * Fix header displayed before redirection
    * Fix upgrade script missing 'return true' at the end