Tried to fix bugs