Yes, to kill a bug even accidentally is indeed a sin.
When asked, “How much liability is there in karmas created unintentionally?”, Param Pujya Dada Bhagwan, the Enlightened being, while explaining to that questioner, said:

Dadashri: What would happen if your hand accidentally falls on a burning charcoal?
Questioner: It would get scorched.
Dadashri: Instant effect! Whether you do it knowingly or unknowingly.
Questioner: If we have to suffer for mistakes made unintentionally, then how much do we have to suffer for the ones made knowingly?
Dadashri: If a man creates a lot of good karma - such karmas that he will become a King, but he creates these karmas unintentionally, without any understanding of what he is doing, then he will become a King without having any conscious knowledge of how to be one. In his next life, he inherits his father’s throne at the age of five, he reigns for about six years before being ousted by another king.
Compare this to a man who becomes a King at the age of thirty and reigns for six years before being replaced. Of the two, which one is able to enjoy the fruit of his karma the most? They both ruled for six years.
Questioner: The older one.
Dadashri: Because he had knowingly bound good karmas, he enjoyed its fruits with awareness, while the child King, enjoyed the fruit of his karma without awareness. Similarly here also if you create good or bad karmas unintentionally, you will enjoy their fruits without awareness. Do you understand that?
I will give you another example. Two friends are walking along and one of them accidentally steps on a cockroach and kills it while the other deliberately steps on another cockroach and crushes it to death. Now what did both the men do?
Questioner: Killed the cockroaches.
Dadashri: According to the laws of Nature, they are both killers. Their crimes are the same. Both are guilty of killing, but their methods were different.
What consequences will both of them face? They will face an insult and a couple of slaps on the face. The one who killed accidentally will come across someone who will insult him and slap him, but because he is born in a lower social status, he will not suffer the insult for too long, whereas the other one being born into a very prestigious family will receive the same kind of slaps and insult, but he suffers so much that he loses sleep for days. The duration of his suffering is considerably longer.
So whatever you do, you must do it with the understanding that you are responsible for all your actions. “You are wholly and solely responsible. God is not responsible at all!”
Nevertheless, if you have been the reason for hurting any living being, knowingly or unknowingly, then there is a powerful tool of Pratikraman to your rescue!
Any wrong act on our part can be cleansed by asking for forgiveness - pratikraman. Pratikraman is the process of recalling the sin, sincerely repenting for it, and asking for forgiveness from God with a vow to never repeat this act of aggression, not even in thoughts, nor through speech or action. Pratikraman reverses the hurt caused to any living being, provided the intensity of pratikraman equals the intensity of the hurt caused.

According to Param Pujya Dada Bhagwan, the founder of Akram Vignan, both merit and demerit karmas are a type of bondage. When we bind demerit karmas, we qualify for pain and misery and when we bind merit karmas, we qualify for materialistic ease and luxury. But the give and take continues such that we are always binding new karmas and hence will have to experience its effects too in future.
Is there any way that we can be released from the karmic bondage forever?

Yes, there certainly is! Attain Self-realisation.
The realisation that ‘I am a pure Soul’ brings about the awareness that ‘I am totally separate from the body, mind, speech, ego, intellect, etc. which I consider to be mine, and also I am not the doer of my thoughts, speech or action, they happen as a result of the karma that I have bound in my previous lifetimes.’

This awareness prevents the binding of new karma and it liberates us from all sins, whether done knowingly or may have happened accidentally.

To know more:

Author's Bio: 

Ambalal M. Patel was a civil contractor by profession. In June 1958, spontaneous Self-Realization occurred within Ambalal M. Patel. From this point on, Ambalal became a Gnani Purush, and the Lord that manifest within him became known as Dada Bhagwan. A Gnani Purush is One who has realized the Self and is able help others do the same. Param Pujya Dada Bhagwan used to go from town to town and country-to-country to give satsang (spiritual discourse) and impart the knowledge of the Self, as well as knowledge of harmonious worldly interactions to everyone who came to meet him. This spiritual science, known as Akram Vignan, is the step-less path to Self-realization.