Add test and fix some minor issues

3 jobs for master in 6 minutes (queued for 1 second)