Fix warning & errors derived from old swift code

Hello I fixed warning & errors

Could you please marge this fix?