some bug fixes in active records