Fixing some bugs in appendix pointed out by Stef