They used to say that if someone becomes uncertain in his prayer, he should seek out what is correct and then perform two prostrations.
أخبرنا سويد بن نصر قال أنبأنا عبد الله عن ابن عون
كانوا يقولون إذا أوهم يتحرى الصواب ثم يسجد سجدتين
[Its chain of transmission is sahih, and it is a maqtu report] Ibn Abu Shayba narrated it, 26/2, from the hadith of Ibn Awn through this same route, and it is in the Kubra, hadith 1170. * Abdullah is Ibn Mubarak.