Fixes and minor improvements