Trying to fix bugged script