Fixed 'referenced before assignment' error.