added proper caller stack inspection