Fix errors found by dialyzer. Now dialyzer test pass without problems.

Still migth be necessary to improve the specs.