Fix 953

Tested under Ubuntu 12.05 for fixing #953.
Btw, this PR also has code in PR #952