fix for model loading

Fixes a bug, and adds tests for the javascript generated by Python plots.Builder