Fixing bug 1142