fixed bug with uninitialized variables