Two bugs corrected

...rce, and checked if the fd already existed in the wrong place.