Added error messages if images cannnot open
Merged with master.