Many fixes after some tests