fixed bugs after refaktoring