Fixing problem when adding images