bug fixes via @csquared