Create select prepare bug and make regression test for it