Fixing lot of bugs