fixed some compiler warnings and prevent duplicate assignments