Fixed minors bugs