add restoreCompletedPurchases and fix several warnings