Fixed some minor bugs in view generation