few fixes and cleanup