fixed function declaration bug