bug fixes & minor improvements