fixed the shitty R error, thanks to an arbitrary stackoverflow search by john