fixes a fatal error that ctr is not defined; fixes #3