Small bug fixes to stabilize plugin