Perhaps there is another libcfitsio.so somewhere before this directory in the libpath. There may be one that is linked to libcfitsio.so.5. You can see if there is one by:
locate libcfitsio.so
Hopefully it will turn up another one somewhere besides /usr/lib/x86_64-linux-gnu.