Fixes from smarx