Fixed some bugs around image file upload handling and registration.