bug fixes and definition tweaks