Bug fixes.

Bug fixes on the lite version that should be ported to the full version.