Fixed buggy code.