fixed toggling layer on/off issue