More bug fix.
Fix segfaults.
Fix example scripts.