Revert "Fixed bug 1828 and added unit test"

This reverts commit f0f45573a917f677bac4fb8e062d8aa6e8a9ecaf.
Revert "Fixed bug 1821"

This reverts commit f887dc022c260f2037ea473d8b2164abce11b16a.