Fix type detection in variable declaration