the rest of the fixes for advanced image viewer which now fully works