Fixes the bugs