added same changes as in master
Merge pull request #388 from mheiniger/fix-custom-fields-develop

added same changes as in master