added extra check
moved to correct function