fixed some query problems, admin redirect logic