add view spec; fix bugs.