Bug fixes.

Fixed: null pointer issue.