Fix bug: passing non variable to end function

Hi, it's a strict standard warning when you pass non-variable to end function. I was getting that error so I fix that and sending PR...