fix for bugs #538