fix corrupted function output