Fixed as_scalar