inlined functions to avoid duplicate symbols problem