Fixing two bugs discovered by @maxmoore14