script tweaks for debugging in ipython