Flat registration in new name without cancelling old registration

Builder sold the flat to Mr. X. Registration done between Builder and Mr X at Bhiwandi registration office around April 2016. Payment made by Mr. X to the builder, partly by loan and partly by cheque. Mr X decided to cancel the flat due to personal reasons. In Jan 2017, Mr. Y went to see properties with same builder. Same flat allotted to Mr. Y, registration also done but between builder and Mr. Y as Mr. Y was not aware of the situation with Mr. X. When Mr. Y wanted to take possession of the flat, he came to know about this issue which was hidden from him by builder. When Mr. Y confronted the builder, builder said that you need not worry as they have a letter from Mr X that he is canceling the flat booking and also in next 2 weeks, the registration agreement between builder and Mr X will get cancelled with registration office. Money received from Mr. Y will be used to repay the loan taken by Mr. X and property will be peacefully transferred to Mr. Y along with loan closure letter. The most surprising thing here was that the registration office doesn't even check before registering the flat in 2 names. Secondly, even if now the property gets transferred to Mr. Y's name, isnt the registration void ab initio as the old sale deed was not cancelled when Mr. Y registered the flat to his name? Ideally, the second agreement should have been between Mr. X and Mr. Y and not between builder and Mr. Y, am i correct? Please advise further action.