quick hack for #547 though could do with a review; at least it doesn't look so fugly now ;)