fixes bug with onclick handler