Only register plugin instance if instance is truey
Added test case