loops for parsing
fix images counting bug