Small cleanup and a bug fix