Hopefully fixed the bugs completely.