fixed casts, now still a couple bugs but whatevzzz