Fixing bunch of bugs.