Bug fixes and stuff

Wasn't up to standards, whoops