fixed a bug causing cpu usage even when idle