added pos null check