fixed reset code also more work done on custom fields.