Some small improvements and fixes