fixed a bit the code