Bugs 4978 and 5045

cf Redmine...