Add more example scripts and fix a few minor bugs