added more checks for uninitialized variables