Fixed image problem and added tests.