fix buggy behaviour after login