fixed encoding error, df empty check, deleted old function