Add instance tests, fix bug encountered in instances.py