Refactor solved a critical bug.