bug fixed, unused vars