Fixed admin panel issues with undefined variables and indexes