Fixed for XHTML compliance. Based on patch from Alexander Delius.