Working on JS. Bug with perks and flaws