fixed bug with nalpha < params.keep