Many bugs corrected

Signed-off-by: jfruitet <jean.fruitet@free.fr>