cleaned & fix function pointer