Fixed bug on changing primary image on existing images