Bugfix in core.py