Should solve #640 (problem 2)
reverted some small changes