modified imageadapter to prevent crashing