fixed bug with booleans and now flattens objects