First contribute

Please apply 2 patches.