fixed some things, as suggested by jvazquez-r7