Fixes many bugs revealed by tests
Merge branch 'master' of github.com:ekylibre/ekylibre