remove extraneous requirements of fs module; add proper value checking in conditional