Fix for #463. Fixed failed test cases