safer version of some methods, by ocan