Fixed bugs #1 Thanks to @rdebath