fixed declaration order for undefined var