improve type conversion and scoping limitations