Fixing some minors bugs