check if p is a proportion

Fix issues