fixed various bugs and typos. added index action.
fixed query in migration 21.
corrected query method.