fix undefined local var