Fix undefined method issue