Fix some functions