This reverts commit 8a98bf4666 because of the solution for bug #1320 was causing a new bug #1540.
8a98bf4666