code fix
tests improved