Fixed missing return value
Added getPubKey support