fixed errors thanks to @cwansart