changed entorpy to check limits