made chargen pre functions work