fixed returning the correct element