Edit: a few minor bug fixes