Tried to fix bugs
Debug