Finally fixed issue16. Fixes 16