Revert e8fa9e533565e, ea0ad9d41c1726 and f36fbfd4c6fde

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
Fix bug #4245

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>