fix memory leak(s)

Change-Id: I2a407cf499f995fe080d855bd18fef41e93fa52c
Remove some dead script code and fix a script comment.

Change-Id: I91ca466d1b6f8a39da50ce61acebc268d0daab3a