Fix some problems

Thanks @abelsiqueira for the review.