Fix #429. Test cases are also added