Fix/workaround for broken tests.

Hello. 

Recent master didn't pass eunit-tests so I tried to track down the commit which caused this. It turned out that commit 44a3ad7d34d41cc91258597556584833e8a6a38b introduced these eunit-test regressions, so I partially reverted it. Not sure I didn't add more breakage but it passes eunit-tests just fine now. 

Could you please review this?