Bug fix: Need to store optimizer object in *opt* variable.