fixed some select_related bugs