Various last minute bug fixes