fixes and minor improvements