major bug fix (ahem...)