Fixes null-pointer exception for updating image