Fixed preoblems with rading from file