add function and fix