minor bug fixes (still intermediate version)