Merging in some bug fixes