Fixed some bugs, thanks @Intyre for the report :3