fixed all problems tomas mentioned