fix bugs in viewentry.php