Fixing the code so now it works

credits go to @ManiacTwister