[TASK] Fix broken test case and bad code smell