An attempt to fix some small bugs