Elgg producing 500 internal server errors for deleted contents

I am facing a problem with contents like if I delete some contents from site and trying to open same url it produce 500 server error instead of 404 not found error.

Due to this error webmasters tools is displaying 1000's of 500 errors which are hurting my site in ranking.

My server and elgg stats are:-

Elgg version=1.8.8

MySQL = 5.5.16

Apache = 2.2.21

PHP = 5.3.8

Below is an example of few links producing 500 error to my site. Please core team let me know is this a error handling problem or some thing wrong on my server.

http://www.royalloops.com/photos/image/14028/harman-and-babbu--desi-romeos-behind-the-screnes-photos

http://www.royalloops.com/photos/owned/deepaman

http://www.royalloops.com/blog/owner/group:918/

http://www.royalloops.com/media/owner/group:6773/?view=opendd