Fixed some bugs in admin and front