Image field: fixes in JavaScript