several fixes.
Merge branch 'master' of https://github.com/castro12321/SG