Fixed a bug reported by Christian Andersson.