now correctly handling tilde ("~")