source.py smaller fixes and tests