Am I allowed to make changes in the accepted paper before sending it to publication
What do you mean by "bugs"?

Do you mean spelling or grammar mistakes, an error in the reference list, etc.?
Or do you mean actual bugs in the algorithm or code? 

If you mean the first one, it is OK to handle this in the proofing stage. Check how the journal does proofing; typically, the journal generates a PDF in their own typesetting system, and you make comments on this PDF with corrections. Here you can fix language mistakes, update references etc. but you should not add substantial new content.

If you mean you have found actual bugs in algorithm, code or results, the ethical thing would be to tell the editor exactly what you have found and let him/her decide.