fixed various type constraint issues