Fix for prepared statement already exists

This PR should fix https://github.com/rails/rails/issues/1627