fix bug in view.php