removed LastError because it was not being used