Fixed a bug thanks to @Paul Thomann