Reverse function fixed