fixing function issue