adding 'if form.data:' back in