Problem solved. I reloaded all images in the picture viewer and scrolled from first to the last image. And reset the personalization to the image folder. Now all images are in proper orientation. I think there might have been a few images direct from the camera which were not touched in PS CS5 and these were the ones which may have caused the problem.
Thanks all for pointing me in the right direction.