Fixed issue of receiving garbage value