Fix some minor bugs in view scripts