trap state fix
fix for NPE
new test combining random and with a select funcion