Making the code more reliable by using weave.evaluateExpression()
directly.
Various bug fixes.

Change-Id: Ie98de92d1698b37899f487e1f9e339880751bbfe