checking file permissions directly since the try and catch exception approach does not work consistently as seen in bug #41