Variable won't get updated in view