Fixed conversion between value types. Removed dead code.