Modified result.php error handling