clean up + correct a bug