Fix minors bugs