fixes error message when define variable after use it