Fixed compile issues on newer versions of swift