Fix isWriteable function