Merge pull request #849 from narfbg/develop-image-lib-fix

Fix a bug and put some comments describing changes from pull #818