Fixed image processing bugs.