fixing some var bugs