fix variable call before def issues