fix name of functions
fix internal bugs