Fixed complex issues with value class support