Fix possible NPE.
Merge changes from 1.0.x SVN.
Fix for bug 1109 and merge other changes from 1.0.x SVN.
Fix for bug 1084.
Merge changes from 1.0.x repo.
Merge changes from 1.0.x repo.
Merge changes from 1.0.x repo.
Merge changes from 1.0.x repo.
Merge changes from 1.0.x repo.
Merge changes from 1.0.x repo.
Merge changes from 1.0.x repo.