fixing #1 and some errors caused by for-own-in