Fixed travis failures

Flak8 and when no user existed failure fixed.