Fixed minor bug in public function