Fix bug 271

These chagnes fix bug 271.

I'd like Zoltan to check them before they're committed, hence the pull request.