changed main functions to avoid error